package com.group3.entity;

import java.io.Serializable;
import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class Merchant implements Serializable {
	private String mId; // 商家Id
	private String mName; // 商家name
	@JsonIgnore
	private String password; // 登录密码
	private String address;// 商家地址
	private String imageUrl;// 商家头像
	private String idCardUrl;// 注册身份证照片
	// private String mStatus; // 目前状态类型：1、待审核，2、通过，3、未通过，4、黑名单
	// private String reason; // 原因

	public Merchant() {
		this.mId = UUID.randomUUID().toString();
	}

	public Merchant(String mName, String password, String address,
			String image, String idCard) {
		super();
		this.mId = UUID.randomUUID().toString();
		this.mName = mName;
		this.password = password;
		this.address = address;
		this.imageUrl = image;
		this.idCardUrl = idCard;
	}

	public Merchant(String mId, String mName, String password, String address,
			String image, String idCard) {
		super();
		this.mId = mId;
		this.mName = mName;
		this.password = password;
		this.address = address;
		this.imageUrl = image;
		this.idCardUrl = idCard;
	}

	public String getmId() {
		return mId;
	}

	public void setmId(String mId) {
		this.mId = mId;
	}

	public String getmName() {
		return mName;
	}

	public void setmName(String mName) {
		this.mName = mName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getIdCardUrl() {
		return idCardUrl;
	}

	public void setIdCardUrl(String idCardUrl) {
		this.idCardUrl = idCardUrl;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		result = prime * result
				+ ((idCardUrl == null) ? 0 : idCardUrl.hashCode());
		result = prime * result
				+ ((imageUrl == null) ? 0 : imageUrl.hashCode());
		result = prime * result + ((mId == null) ? 0 : mId.hashCode());
		result = prime * result + ((mName == null) ? 0 : mName.hashCode());
		result = prime * result
				+ ((password == null) ? 0 : password.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Merchant other = (Merchant) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		if (idCardUrl == null) {
			if (other.idCardUrl != null)
				return false;
		} else if (!idCardUrl.equals(other.idCardUrl))
			return false;
		if (imageUrl == null) {
			if (other.imageUrl != null)
				return false;
		} else if (!imageUrl.equals(other.imageUrl))
			return false;
		if (mId == null) {
			if (other.mId != null)
				return false;
		} else if (!mId.equals(other.mId))
			return false;
		if (mName == null) {
			if (other.mName != null)
				return false;
		} else if (!mName.equals(other.mName))
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Merchant [mId=" + mId + ", mName=" + mName + ", password="
				+ password + ", address=" + address + ", imageUrl=" + imageUrl
				+ ", idCardUrl=" + idCardUrl + "]";
	}

}
